<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.list.AnShangPinChaKanYiLiaoJiGouMuLu"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>详情</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
			<li class="active"><a href="#">交易</a></li>
			<li class="active"><a href="#">药品遴选情况</a></li>
            <li class="active"><a href="#">按药品查询</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                    <div class="textalign1"><spring:message code="message.lable.yiLiaoJiGouMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="hospName" name="hospName" placeholder="<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>" />
                    	</div>
                    <div class="textalign"><spring:message code="message.lable.yiLiaoJiGouBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="hospCode" name="hospCode" placeholder="<spring:message code="message.lable.yiLiaoJiGouBianMa"/>" />
                    	</div>
				          <c:if test="${goods.userType==1}">       
				                    <div class="textalign1"><spring:message code="message.listForm.suoShuDiQu"/><spring:message code="message.yanZheng.maoHao"/></div>
				                    <div class="boxinput">
				                       <table style="width:100%;">
				                           <tr>
				                              <td style="width:33%">
				                                <select class="textinput" id="area1" name="area1" readonly="true">
				                                	<option value="${area.areaId}">${area.areaName}</option>
				                                </select>
				                              </td>
				                              <td style="width:33%">   
				                                <select class="textinput" id="area2" name="area2" ></select>
				                                </td>
				                              <td style="width:33%">
				                                <select class="textinput" id="area3" name="area3" ></select>
				                              </td>
				                           </tr> 
				                        </table>     
				                    </div>
				          </c:if>
                    <div class="textalign1" >    
                    <button type="button" class="btn btn-success btn-sm" onclick="search()" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                	</div>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup" id="bottongroup">
            <label onclick="window.location.href='${ctx}/hospCatalog/toGoodsList.html'" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></label>
        </div>
        
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#hospName,#hospCode,#area1,#area2,#area3').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#hospName").focus();//加载页面光标在第一个查询框内
    
    
    
	   
	    
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/hospCatalog/getCatalogByGoods.html",
                mtype: "POST",
                postData:{"goodsCode":"${goods.goodsCode}","userType":"${goods.userType}"},
                datatype: "json",
              //  autowidth: true,
            //    height: 276,
                colNames: [
                           'hospId',
                           '<spring:message code="message.lable.yiLiaoJiGouBianMa"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>',
                           '<spring:message code="message.listForm.CaiGouJia"/>',
                           
                           '<spring:message code="message.listForm.suoShuDiQu"/>', 
                           '<spring:message code="message.listForm.YiLiaoJiGouFenLei"/>',
                           '<spring:message code="message.listForm.YiLiaoJiGouLeiXin"/>', 
                           '<spring:message code="message.lable.yiLiaoJiGouDengJi"/>', 
                           '<spring:message code="message.listForm.zuZhiJiGouDaiMa"/>',
                           '默认配送企业'
                           ],
                colModel: [
                    { name: 'hospId',hidden:true, width: 0 , align:"center" ,sortable: false},     
                    { name: 'hospCode', width: 100 , align:"center",sortable: false},
                    
                   
                    { name: 'hospName', width: 150 , align:"center" ,sortable: false},

                    {name:'proPrice',index:'proPrice', width:60 , align:"center",sortable: false,sorttype:false,
                 	   formatter:function(cellvalue, options, row){
                           return formatAmount(cellvalue, options, row);
                       }},
                       
                       
                    
                    { name: 'areaName', width: 120 , align:"center" ,sortable: false},
                    { name: 'hospClassifyName', width: 110 , align:"center" ,sortable: false},
                    { name: 'hospTypeName', width: 80 , align:"center" ,sortable: false},
                    { name: 'hospLevelName', width: 80 , align:"center" ,sortable: false},
                    { name: 'orgCode', width: 90 , align:"center",sortable: false },
                    {name:'psCompName',index:'psCompName', width:150 , align:"center",sortable: false},
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "${goods.drugCode}/${goods.drugName}/${goods.formName}/${goods.specName}/${goods.factor}/${goods.unit}/${goods.materialName}",
                jsonReader: {
                    repeatitems: false,
                    id: "hospId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight",create());
            
        });
        
        function search(page) {
            var hospCode = $.trim($("#hospCode").val());
            var hospName = $.trim($("#hospName").val());
            var area = $("#area1").length;
            var area2 ="";
            var area3 ="";
            if(area>0){
            	area2 =$.trim($("#area2").val());
            	area3 =$.trim($("#area3").val());
            }
            $("#gridlist").jqGrid("clearGridData");
                $("#gridlist").jqGrid('setGridParam',{  
                mtype: "POST",
                datatype:'json',
                postData:{"hospCode":hospCode, "hospName":hospName,"area2":area2,"area3":area3},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
        
        $("#area2").HNSelect({
            parent_selector: "#area1",  url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
            func: function () {
                $("#area3").HNSelect({
                    parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                });
            }
        });

    </script>
</body>
</html>